/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.timesoft.base.header.ctrl;

import com.timesoft.zk.common.ctrl.IncludePageWsController;
import com.timesoft.zk.common.event.MainEventWsListener;
import org.apache.log4j.Logger;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Button;
import org.zkoss.zul.Div;
import org.zkoss.zul.Include;
import org.zkoss.zul.Textbox;

/**
 *
 * @author sorasaks
 */
public class HeaderCtrl extends IncludePageWsController {
    
    private static final Logger LOG = Logger.getLogger(HeaderCtrl.class);
    
    public static final String ATTRIBUTE_SEARCH_BOX = "searchBox";
    
    private Div divProfile;
    private Div divBlogs;
    private Div divShare;
    private Div divFriends;
    
    private Textbox txtSearch;
    private Button btnSearch;
    
    private Include searchBox;

    public HeaderCtrl() throws Exception {
        super();
    }

    @Override
    public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp); //To change body of generated methods, choose Tools | Templates.
        initialComponent();
        initialEventListener();
    }
    
    private void initialComponent() {
        desktop.setAttribute(ATTRIBUTE_SEARCH_BOX, searchBox);
    }
    
    private void initialEventListener() throws Exception {
        divProfile.addEventListener(Events.ON_CLICK, new divProfileEventListener());
        divBlogs.addEventListener(Events.ON_CLICK, new divBlogsEventListener());
        divShare.addEventListener(Events.ON_CLICK, new divShareEventListener());
        divFriends.addEventListener(Events.ON_CLICK, new divFriendsEventListener());
        
        txtSearch.addEventListener(Events.ON_OK, new txtSearchEventListener());
        
        btnSearch.addEventListener(Events.ON_CLICK, new btnSearchEventListener());
    }

    private class divProfileEventListener extends MainEventWsListener implements EventListener {

        public divProfileEventListener() throws Exception {
            super();
        }

        @Override
        public void onEvent(Event t) throws Exception {
            
        }
    }
    
    private class divBlogsEventListener extends MainEventWsListener implements EventListener {

        public divBlogsEventListener() throws Exception {
            super();
        }

        @Override
        public void onEvent(Event t) throws Exception {
            
        }
    }
    
    private class divShareEventListener extends MainEventWsListener implements EventListener {

        public divShareEventListener() throws Exception {
            super();
        }

        @Override
        public void onEvent(Event t) throws Exception {
            
        }
    }
    
    private class divFriendsEventListener extends MainEventWsListener implements EventListener {

        public divFriendsEventListener() throws Exception {
            super();
        }

        @Override
        public void onEvent(Event t) throws Exception {
            
        }
    }
    
    private class txtSearchEventListener extends MainEventWsListener implements EventListener {

        public txtSearchEventListener() throws Exception {
            super();
        }

        @Override
        public void onEvent(Event t) throws Exception {
            
        }
    }
    
    private class btnSearchEventListener extends MainEventWsListener implements EventListener {

        public btnSearchEventListener() throws Exception {
            super();
        }

        @Override
        public void onEvent(Event t) throws Exception {
            
        }
    }
}
